package com.itfitness.licenseocrdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class MainActicity extends AppCompatActivity {
    static {
        System.loadLibrary("native-lib");
    }
    private Button btScanning;
    private TextView tvCardnumber;
    static {
        System.loadLibrary("native-lib");
    }
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btScanning = (Button) findViewById(R.id.bt_scanning);
        tvCardnumber = (TextView) findViewById(R.id.tv_cardnumber);
        btScanning.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivityForResult(new Intent(MainActicity.this, ScanningCardOcrActivity.class), 1);
            }
        });
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        String idCard = data.getStringExtra("idCard");
        if(!TextUtils.isEmpty(idCard)){
            tvCardnumber.setText(idCard);
        }
    }
}
